package com.zbw.weightlibrary.Util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by Administrator on 2018/8/13.
 */

public class ThreadPoolManager {
    private final ExecutorService service;
    private static final ThreadPoolManager manager = new ThreadPoolManager();

    private ThreadPoolManager() {
        //Runtime.getRuntime().availableProcessors() 为cpu线程数量
        //int num = Runtime.getRuntime().availableProcessors() * 1;

        this.service = Executors.newFixedThreadPool(1);
    }

    public static ThreadPoolManager getInstance() {
        return manager;
    }

    public void executeTask(Runnable runnable) {
        this.service.execute(runnable);
    }
}
